home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group99a.txt
/
000187_icon-group-sender _Tue Sep 7 16:59:11 1999.msg
< prev
next >
Wrap
Internet Message Format
|
2000-09-20
|
6KB
Return-Path: <icon-group-sender>
Received: (from root@localhost)
by baskerville.CS.Arizona.EDU (8.9.1a/8.9.1) id QAA07190
for icon-group-addresses; Tue, 7 Sep 1999 16:58:51 -0700 (MST)
Message-Id: <199909072358.QAA07190@baskerville.CS.Arizona.EDU>
From: "Frank Lhota" <lhotaf@lexma.meitech.com>
To: <icon-group@optima.CS.Arizona.EDU>, "Garry" <memphis@macconnect.com>
Subject: Re: Is open(..,"b") broken in MPW Icon 9.0?
Date: Fri, 3 Sep 1999 09:04:21 -0400
X-Priority: 3
X-MSMail-Priority: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
Errors-To: icon-group-errors@optima.CS.Arizona.EDU
Status: RO
Amazingly enough, it looks like the code for the Icon open function does not
include the right code for opening a file in bi-directional mode. I think I
can help you patch the source code, however, so that it will work correctly
In the file RUNTIME\FSYS.R, search for the text "fsys.05". This search
should bring you to the following comment:
/*
* The following code is operating-system dependent [@fsys.05]. Handle open
* modes.
*/
Previous to this section, the bits of the variable status have been set to
indicate the desired open mode. The bits in status are translated into a
mode string to be passed on to the C fopen function. Right before this
comment, the first mode character is set to one of 'r', 'w', or 'a'. The
possible mode parameter characters are, unfortunately, not that well
standardized. The code after this comment should have the OS dependent code
for handling the addition open modes. For the Macintosh, we see
#if MACINTOSH
/* nothing to do */
#endif /* MACINTOSH */
This is undoubtedly wrong; there are definitely things to do here for the
Mac. At a minimum, we should add '+' to mode if both the Fs_Read and
Fs_Write flags in status are on. Also, I believe that we also need to
process the Fs_Untrans flag for the Macintosh, since the Mac does not use
the Unix text file format. I am not sure what mode characters MPW uses to
indicate translated / untranslated mode; in my fix, I assume that MPW fopen
uses 't' for translated mode, 'b' for untranslated mode. Given, this, the
MACHINTOSH section for the open modes should look like this:
#if MACINTOSH
if ((status & (Fs_Read|Fs_Write)) == (Fs_Read|Fs_Write)) {
mode[1] = '+';
mode[2] = ((status & Fs_Untrans) != 0) ? 'b' : 't';
}
else mode[1] = ((status & Fs_Untrans) != 0) ? 'b' : 't';
#endif /* MACINTOSH */
Try making this change and rebuild.
----- Original Message -----
From: Garry <memphis@macconnect.com>
To: Frank Lhota <lhotaf@lexma.meitech.com>;
<icon-group@optima.CS.Arizona.EDU>
Sent: Thursday, September 02, 1999 6:17 PM
Subject: Re: Is open(..,"b") broken in MPW Icon 9.0?
At 12:32 -0400 1999-09-02, Frank Lhota wrote:
>The Icon file management routines are based on the C <stdio.h> facilitates.
>The Icon open mode specifications are mapped to the C fopen mode parameter,
>and unfortunately the available fopen modes vary from platform to platform.
>
>Do you have a C compiler for the Macintosh MPW environment? If so, try to
>see which C fopen modes will give you the desired results. From this, we
can
>figure out the how to fix the Icon run time code.
Thanks for your response Frank. I don't quite understand; the mode to pass
to fopen for updating a file is "r+" on every platform (the lower level Mac
toolbox call is something funky but the standard C library function is
"standard"). I checked the "r+" mode on my problem file using a C program.
"f = fopen( "Testfile", "r+" );" works fine. Thereafter I can read lines
with fgets() or write to random locations using fseek() and fprintf() or
fputs().
Of course I'm using an up-to-date StdCLib (I'm using MacOS 8.6 and MPW / MrC
with Universal Interfaces 3.2). I'm also using the new file system, HFS+,
which (I hope) is transparent at the level of standard C functions. Maybe
MPW Icon (9.0) just needs to be recompiled against new libraries -- but
that's easier said than done. It would become somewhat larger (because of
changing from 68K to PowerPC RISC instructions) and much faster. Would
anyone be willing to help me?
(As for my immediate problem -- it is perhaps most simply solved by using
Icon for the analysis and reporting functions, in which it excels, and
dropping back to C for writing my files in the first place. Since what I'm
working on is a notekeeper/outliner to use in my MPW programming
environment, I can tie Icon and C programs together using the Shell.)
>----- Original Message -----
>From: Garry <memphis@macconnect.com>
>
>> The most up-to-date Icon available for the Macintosh MPW environment is
>> version 9.0, which I think may have been implemented by Bob Alexander
>> (email address?). I've implemented most of an outline processor / note
>> organizer for MPW using Icon; maybe I'll proceed to try using it for
>> keeping source code in outline form, BUT after more than a month of fun
>> with Icon I've run into a problem!! I can't open a file for update
>> (read/write). When I follow the Icon practice of opening my file with
>> "b" mode I find that I can read it but I can not write to the file. For
>> example if I execute
>> f := open( "Testfile", "b" )
>> seek( f )
>> writes( f, "**" )
>> where "Testfile" is a small test file created previously, then I get the
>> message
>> Run-time error 214
>> input/output error
>>
>> I've tried specifying "r+" mode or "b+r" or "ub" mode without success.
--
Garry Roseman <mailto:memphis@macconnect.com>
Tech Writer & Freelance Programmer
Memphis, TN USA